f = input("введите скобочную последовательность: ")
s1 = []
for c in f:
    if c == '(':
        s1.append(c)
    if c == ')':
        if len(s1) > 0 and s1[-1] == '(':
            s1.pop()

for c in f:
    if c == '{':
        s1.append(c)
    if c == '}':
        if len(s1) > 0 and s1[-1] == '{':
            s1.pop()

for c in f:
    if c == '[':
        s1.append(c)
    if c == ']':
        if len(s1) > 0 and s1[-1] == '[':
            s1.pop()

if len(s1) == 0:
    print("Верная")
else:
    print("Неверная")

